<title>订单管理</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>订单</cite></a>
        <a><cite>订单管理</cite></a>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="layadmin-useradmin-formlist">
            <div class="layui-form-item">

                <div class="layui-inline">
                    <label class="layui-form-label">商户订单号</label>
                    <div class="layui-input-block">
                        <input type="text" id="outTradeNo" name="outTradeNo" placeholder="请输入商户订单号" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">商品类型</label>
                    <div class="layui-input-block">
                        <select name="productType">
                            <option value="0">普通会员</option>
                            <option value="1">超级会员</option>
                        </select>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">订单状态</label>
                    <div class="layui-input-block">
                        <select name="status">
                            <option value="0">未支付</option>
                            <option value="2">支付完成</option>
                        </select>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">创建时间</label>
                    <div class="layui-input-inline">
                        <label for="startTime">
                            <input type="text" class="layui-input" name="startTime" id="startTime" placeholder="开始时间">
                        </label>
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <label for="endTime">
                            <input type="text" class="layui-input" name="endTime" id="endTime" placeholder="结束时间">
                        </label>
                    </div>
                </div>

                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-order-back-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <table id="LAY-order-back-manage" lay-filter="LAY-order-back-manage"></table>
        </div>
    </div>
</div>

<script>
    layui.use('useradmin', layui.factory('useradmin')).use(['admin', 'useradmin', 'table'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,view = layui.view
            ,table = layui.table
            ,form = layui.form;

        form.render(null, 'layadmin-useradmin-formlist');

        //监听搜索
        form.on('submit(LAY-order-back-search)', function(data){
            var field = data.field;
            console.log(field);
            var outTradeNo = field.outTradeNo;
            var productType = field.productType;
            var status = field.status;
            var startTime = field.startTime;
            var endTime = field.endTime;
            //执行重载
            table.reload('LAY-order-back-manage', {
                url:'/backstage/order/pageLimit',
                where: {
                    outTradeNo:outTradeNo,
                    productType:productType,
                    status:status,
                    startTime:startTime,
                    endTime:endTime
                },page: {
                    curr:1
                }
            });
        });

        /*$('.layui-btn.layuiadmin-btn-admin').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });*/
    });
</script>
<script>
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        /*加载日历*/
        laydate.render({
            elem: '#startTime'
            ,type: 'datetime'
        });
        laydate.render({
            elem: '#endTime'
            ,type: 'datetime'
        });
    });
</script>